package com.twinkle.controller;

import com.twinkle.model.Menu;
import com.twinkle.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @title: HomeController
 * @description: 主页接口类
 * @author: Paul
 * @date: 2023/4/5 20:57
 */
@Controller
public class HomeController {

//    @Autowired
//    private NoticeService noticeService;
    @Autowired
    private MenuService menuService;

    @RequestMapping(value = "/", method = { RequestMethod.GET, RequestMethod.POST })
    public String home(HttpServletRequest request) {

        String allMenuTrees = menuService.getAllUserMenu();
        request.setAttribute("allMenuTrees", allMenuTrees);


        request.setAttribute("username", "Paul");
//        request.setAttribute("tip", ((User) SecurityUtils.getSubject().getPrincipal()).getRoleTip());
//        request.setAttribute("sex", Userinfo.getSex());
        return "algo_plat/index1_u";

    }

    @RequestMapping(value = "/welcome", method = { RequestMethod.GET })
    public String welcome() {
        return "algo_plat/welcome";
    }
}
